package com.wxapp.system.api.feign;

import com.wxapp.common.constant.pojo.vm.ResultVm;
import com.wxapp.system.api.feign.fallback.UploadFeignFallBack;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author lgl
 */
@FeignClient(value = "wxapp-system", fallback = UploadFeignFallBack.class)
public interface UploadFeign {
    @PostMapping("system/file/upload/image")
    @Operation(summary ="上传文件")
    ResultVm<String> uploadImage(HttpServletRequest request, MultipartFile file, @RequestParam(value = "path", required = false) String path) throws Exception;


    @GetMapping("system/file/file/{name}")
    @Operation(summary ="得到对象")
    ResultVm<String> getFile(HttpServletResponse response, @PathVariable(value = "name") String name);
}
